package com.dy.cloud.service.impl;


import cn.hutool.core.lang.UUID;
import com.dy.cloud.service.IMessageProviderService;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;

import javax.annotation.Resource;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/10/4 12:41
 * @Version 1.0 (版本)
 */
@EnableBinding(Source.class)
public class IMessageProviderServiceImpl implements IMessageProviderService {
    @Resource
    private MessageChannel output;  //消息发送管道

    @Override
    public String send() {
        String uuid = UUID.randomUUID().toString();
        output.send(MessageBuilder.withPayload(uuid).build());
        System.out.println("***********uuid = " + uuid);
        return null;
    }
}
